<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('在线实验项目列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>实验名称：</label>
                                <input type="text" name="experimentName"/>
                            </li>
                            <li>
                                <label>是否开放：</label>
                                <!--<input type="text" name="ifOpen"/>-->
                                <select name="ifOpen">
                                    <option value="">请选择</option>
                                    <option value="1">开放</option>
                                    <option value="2">不开放</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:arrange:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:arrange:remove')}]];
        var prefix = ctx + "system/arrange";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "在线实验项目",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'experimentId',
                    title: '实验编号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'experimentPhoto',
                    title : '实验图片',
                    formatter: function(value, row, index) {
                        return $.table.imageView(ctx+value);
                    }
                },
                {
                    field: 'experimentName',
                    title: '实验名称'
                },
                {
                    field: 'experimentHref',
                    title: '实验链接'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        /*actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="arrangeAll(\'' + row.experimentId + '\')"><i class="fa fa-save"></i>布置实验</a>&nbsp;');*/
                        actions.push('<a class="btn btn-primary btn-xs " href="javascript:void(0)" onclick="makeExperiment(\'' + row.experimentId + '\')"><i class="fa fa-save"></i>实验体验</a>&nbsp;');
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.experimentId + '\')"><i class="fa fa-edit"></i>实验结果批改</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        /**
         * 实验体验
         * @param val
         */
        function makeExperiment(val) {
            window.location.href = ctx + "system/report" + "/startExperiment?experimentId="+val;
        }
    </script>
</body>
</html>